home *** CD-ROM | disk | FTP | other *** search
/ Champak 147 / (Vol 147) Jan 21 2012.iso / Interface / it.dig / scripts / __Packages / mx / controls / gridclasses / DataGridColumn.as next >
Encoding:
Text File  |  2012-01-21  |  3.6 KB  |  136 lines

  1. class mx.controls.gridclasses.DataGridColumn extends mx.styles.CSSStyleDeclaration
  2. {
  3.    var columnName;
  4.    var parentGrid;
  5.    var colNum;
  6.    var __header;
  7.    var headerCell;
  8.    var __cellRenderer;
  9.    var __headerRenderer;
  10.    var __labelFunction;
  11.    var styleName;
  12.    var editable = true;
  13.    var sortable = true;
  14.    var resizable = true;
  15.    var sortOnHeaderRelease = true;
  16.    var __width = 50;
  17.    function DataGridColumn(colName)
  18.    {
  19.       super();
  20.       this.columnName = colName;
  21.       this.headerText = colName;
  22.    }
  23.    function get width()
  24.    {
  25.       return this.__width;
  26.    }
  27.    function set width(w)
  28.    {
  29.       delete this.parentGrid.invSpaceColsEqually;
  30.       if(this.parentGrid != undefined && this.parentGrid.hasDrawn)
  31.       {
  32.          var _loc2_ = this.resizable;
  33.          this.resizable = false;
  34.          this.parentGrid.resizeColumn(this.colNum,w);
  35.          this.resizable = _loc2_;
  36.       }
  37.       else
  38.       {
  39.          this.__width = w;
  40.       }
  41.    }
  42.    function set headerText(h)
  43.    {
  44.       this.__header = h;
  45.       this.headerCell.setValue(h);
  46.    }
  47.    function get headerText()
  48.    {
  49.       return this.__header != undefined ? this.__header : this.columnName;
  50.    }
  51.    function set cellRenderer(cR)
  52.    {
  53.       this.__cellRenderer = cR;
  54.       this.parentGrid.invColChange = true;
  55.       this.parentGrid.invalidate();
  56.    }
  57.    function get cellRenderer()
  58.    {
  59.       return this.__cellRenderer;
  60.    }
  61.    function set headerRenderer(hS)
  62.    {
  63.       this.__headerRenderer = hS;
  64.       this.parentGrid.invInitHeaders = true;
  65.       this.parentGrid.invalidate();
  66.    }
  67.    function get headerRenderer()
  68.    {
  69.       return this.__headerRenderer;
  70.    }
  71.    function set labelFunction(f)
  72.    {
  73.       this.__labelFunction = f;
  74.       this.parentGrid.invUpdateControl = true;
  75.       this.parentGrid.invalidate();
  76.    }
  77.    function get labelFunction()
  78.    {
  79.       return this.__labelFunction;
  80.    }
  81.    function getStyle(prop)
  82.    {
  83.       var _loc3_ = this[prop];
  84.       if(_loc3_ == undefined)
  85.       {
  86.          if(this.styleName != undefined)
  87.          {
  88.             if(this.styleName instanceof mx.styles.CSSStyleDeclaration)
  89.             {
  90.                _loc3_ = this.styleName.getStyle(prop);
  91.             }
  92.             else
  93.             {
  94.                _loc3_ = _global.styles[this.styleName].getStyle(prop);
  95.             }
  96.          }
  97.          if((_loc3_ == undefined || _loc3_ == _global.style[prop] || _loc3_ == _global.styles[this.parentGrid.className][prop]) && prop != "backgroundColor")
  98.          {
  99.             _loc3_ = this.parentGrid.getStyle(prop);
  100.          }
  101.       }
  102.       return _loc3_;
  103.    }
  104.    function __getTextFormat(tf, bAll, fieldInst)
  105.    {
  106.       var _loc4_ = undefined;
  107.       if(this.parentGrid.header_mc[fieldInst._name] != undefined)
  108.       {
  109.          _loc4_ = this.getStyle("headerStyle").__getTextFormat(tf,bAll,fieldInst);
  110.          if(_loc4_ != false)
  111.          {
  112.             _loc4_ = this.parentGrid.getStyle("headerStyle").__getTextFormat(tf,bAll,fieldInst);
  113.          }
  114.          if(_loc4_ == false)
  115.          {
  116.             return _loc4_;
  117.          }
  118.       }
  119.       if(this.styleName != undefined)
  120.       {
  121.          var _loc8_ = typeof this.styleName != "string" ? this.styleName : _global.styles[this.styleName];
  122.          _loc4_ = _loc8_.__getTextFormat(tf,bAll);
  123.          if(!_loc4_)
  124.          {
  125.             return _loc4_;
  126.          }
  127.       }
  128.       _loc4_ = super.__getTextFormat(tf,bAll,fieldInst);
  129.       if(_loc4_)
  130.       {
  131.          return this.parentGrid.__getTextFormat(tf,bAll);
  132.       }
  133.       return _loc4_;
  134.    }
  135. }
  136.